<%@page import="database.DBBarang"%>
<%@page import="database.DBPegawai"%>
<%@page import="java.util.List"%>
<%@page import="database.DBClass"%>
<%@ include file="header.jsp"%>
<%@page import="model.Barang"%>
<%@page import="model.Penjualan"%>
<%@page import="model.PegawaiBean"%>
<% Penjualan bean = new Penjualan();
    //get request from servlet if data is invalid

    if (request.getAttribute("updateuser") != null) {
        bean = (Penjualan) request.getAttribute("updateuser");
    }
%>
<SCRIPT LANGUAGE="JavaScript">
    window.defaultStatus = "Let count your number"

    function kali()
    {
        a = 5000
        b = eval(jual.jmlbarang.value)
        c = a * b
        jual.totharga.value = c
    }



</SCRIPT>


<!-- start: Content -->
<div id="content" class="span10">


    <ul class="breadcrumb">
        <li>
            <i class="icon-home"></i>
            <a href="index.html">Home</a>
            <i class="icon-angle-right"></i> 
        </li>
        <li>
            <i class="icon-edit"></i>
            <a href="#">Forms</a>
        </li>
    </ul>



    <div class="row-fluid sortable">
        <div class="box span12">
            <div class="box-header" data-original-title>
                <h2><i class="halflings-icon edit"></i><span class="break"></span>Form Pengadaan</h2>

            </div>
            <div class="box-content">
                <form class="form-horizontal" name="jual" method="post" action="PenjualanServlet">
                    <fieldset>
 <div class="control-group success">

                            <div class="controls">
                                <input class="input-xlarge" type="hidden" id="id" name="id" value="<%=bean.getPenjualanId()%>" <%=request.getAttribute("updateuser") != null ? "readonly" : ""%>>

                            </div>
                        </div>
                        <div class="control-group success">
                            <label class="control-label" for="pegawai">Pegawai:</label>
                            <div class="controls">
                                <select id="pegawai" name="pegawai" data-validation="required" data-validation-error-msg="Pegawai harus dipilih" data-rel="chosen">
                                    <option value="<%=bean.getIdPegawai()%>"><%=bean.getNama()%></option>
                                    <%
                                        PegawaiBean beans = new PegawaiBean();

                                       

                                        List list = (List) request.getAttribute("listPegawaiPenjualan");
                                       // request.setAttribute("list", list);

                                        if (list != null) {
                                            for (int i = 0; i < list.size(); i++) {
                                                beans = (PegawaiBean) list.get(i);

                                    %>
                                    <option value="<%=beans.getPegawaiId()%>"><%=beans.getNama()%></option>

                                    <%          }
                                        }
                                    %>
                                </select>
                            </div>
                        </div>

                        
                        <div class="control-group success">
                            <label class="control-label" for="tanggal">Tanggal:</label>
                            <div class="input-group date form_date controls" data-date-format="yyyy-mm-dd hh:mm:ss" data-link-format="yyyy-mm-dd hh:mm:ss">
                                <input class="input-xlarge" size="16" type="text" data-validation="required" data-validation-error-msg="Tanggal harus diisi" id="tanggal" name="tanggal" value="<%=bean.getTgl()%>" placeholder="Tanggal penjualan">
                                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                            </div>

                        </div>
                        <div class="control-group success">
                            <label class="control-label" for="inputSuccess">Jumlah barang</label>
                            <div class="controls">
                                <input class="input-xlarge" type="text" data-validation="required number" data-validation-error-msg="Jumlah barang harus diisi dengan angka" id="jmlbarang" name="jmlbarang" value="<%=bean.getJumlahBarang()%>">
                               
                            </div>
                        </div>
                        <div class="control-group success">
                            <label class="control-label" for="inputSuccess">Total harga:</label>
                            <div class="controls">
                                <input class="input-xlarge" type="text" id="totharga" name="totharga" data-validation="required number" data-validation-error-msg="Total harga harus diisi dengan angka" onclick="kali()" placeholder="Klik untuk menghitung total harga" value="<%=bean.getJumlahHarga()%>">
                               
                            </div>
                        </div>

                        <div class="form-actions">
                            <button type="submit" class="btn btn-primary" name="action" id="action" value="<%=bean.getAction()%>"><%=bean.getAction()%></button>
                            <button class="btn">Cancel</button>
                        </div>
                    </fieldset>
                </form>

            </div>
        </div><!--/span-->

    </div><!--/row-->




</div><!--/.fluid-container-->

<!-- end: Content -->
</div><!--/#content.span10-->
</div><!--/fluid-row-->

<%@ include file="footer.jsp"%>